package com.xiaoyu.lingdian.service.impl;

import java.util.Map;
import java.util.List;
import java.util.HashMap;
import com.xiaoyu.lingdian.core.mybatis.page.Page;
import com.xiaoyu.lingdian.core.mybatis.page.PageRequest;
import com.xiaoyu.lingdian.service.CoreIntegralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xiaoyu.lingdian.core.mybatis.dao.MyBatisDAO;
import com.xiaoyu.lingdian.entity.CoreIntegral;

@Service("coreIntegralService")
public class CoreIntegralServiceImpl implements CoreIntegralService {

	@Autowired
	private MyBatisDAO myBatisDAO;

	@Override
	public boolean updateCoreIntegral(CoreIntegral coreIntegral) {
		myBatisDAO.update(coreIntegral);
		return true;
	}

	@Override
	public boolean deleteCoreIntegral(CoreIntegral coreIntegral) {
		myBatisDAO.delete(coreIntegral);
		return true;
	}

	private static final String DELETEBATCH_COREINTEGRAL_BY_IDS="deleteBatchCoreIntegralByIds";
	@Override
	public boolean deleteBatchByIds(List<String> list ) {
		Map<String, Object> hashMap = new HashMap<String, Object>();
		hashMap.put("list", list);
		myBatisDAO.delete(DELETEBATCH_COREINTEGRAL_BY_IDS,hashMap);
		return true;
	}

	@Override
	public CoreIntegral getCoreIntegral(CoreIntegral coreIntegral) {
		return (CoreIntegral) myBatisDAO.findForObject(coreIntegral);
	}

	private static final String FIND_COREINTEGRAL_FOR_LISTS="findCoreIntegralForLists";

	@SuppressWarnings("unchecked")
	@Override
	public List<CoreIntegral> findCoreIntegralList() {
		return myBatisDAO.findForList(FIND_COREINTEGRAL_FOR_LISTS, null);
	}

	private static final String FIND_COREINTEGRAL_FOR_PAGES="findCoreIntegralForPages";

	@SuppressWarnings("unchecked")
	@Override
	public Page<CoreIntegral> findCoreIntegralPage(int pageNum, int pageSize) {
		Map<String, Object> hashMap = new HashMap<String, Object>();
		return myBatisDAO.findForPage(FIND_COREINTEGRAL_FOR_PAGES, new PageRequest(pageNum, pageSize, hashMap));
	}

//<=================定制内容开始==============
//==================定制内容结束==============>

}